package com.study.langchain4j.api.tools;

import com.study.langchain4j.service.tools.ToolLowLevelService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xl-9527
 * @since 2025/11/2
 **/
@RestController
@RequestMapping("ai/tools/low-level")
public class ToolLowLevelApi {

    private final ToolLowLevelService.ToolLowLevelAiService toolLowLevelAiService;
    private final ToolLowLevelService.ToolLowLevelAiServiceWithManual toolLowLevelAiServiceWithManual;

    public ToolLowLevelApi(final ToolLowLevelService.ToolLowLevelAiService toolLowLevelAiService, final ToolLowLevelService.ToolLowLevelAiServiceWithManual toolLowLevelAiServiceWithManual) {
        this.toolLowLevelAiService = toolLowLevelAiService;
        this.toolLowLevelAiServiceWithManual = toolLowLevelAiServiceWithManual;
    }

    @RequestMapping("get-now-date")
    public String getNowDate(@RequestParam("userMessage") String userMessage) {
        return toolLowLevelAiService.getNowDate(userMessage).content();
    }

    @RequestMapping("get-now-date-with-prompt")
    public String getNowDateWithPrompt(@RequestParam("userMessage") String userMessage) {
        return toolLowLevelAiServiceWithManual.getNowDateWithPrompt(userMessage).text();
    }
}
